
from socket import *

#创建socket对象
client_socket = socket.socket()
#ip地址和主机端口
ip='127.0.0.1'
port=8888
client_socket.connect((ip,port))
print('服务器建立成功')
#发送数据
client_socket.send('hello'.encode('utf-8'))
#关闭
client_socket.close()
print('发送完毕')


